using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WSingle_WSingle : System.Web.UI.Page
{
    private Srvtools.WebDataSet WMaster;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitializeComponent();

            Master.DataSource = WMaster;
        }
    }

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WSingle_WSingle));
        this.WMaster = new Srvtools.WebDataSet();
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).BeginInit();
        // 
        // WMaster
        // 
        this.WMaster.Active = true;
        this.WMaster.AlwaysClose = false;
        this.WMaster.DeleteIncomplete = true;
        this.WMaster.Guid = null;
        this.WMaster.LastKeyValues = null;
        this.WMaster.Locale = new System.Globalization.CultureInfo("zh-CN");
        this.WMaster.PacketRecords = -1;
        this.WMaster.Position = -1;
        this.WMaster.RemoteName = "ServiceSheet.View_Supplies";
        this.WMaster.ServerModify = false;
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).EndInit();

    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string Sql = "";

        if (TextBox1.Text.Length > 0) Sql = Sql + " (SName Like '%" + TextBox1.Text + "%') ";
        string Ast = (Sql.Length == 0) ? "" : "and";
        if (WebDropDownList1.SelectedValue.Length > 0 && WebDropDownList1.SelectedValue != "0")
            Sql = Sql + Ast + " (TypeId =  " + WebDropDownList1.SelectedValue + " ) ";
        string Ast2 = (Sql.Length == 0) ? "" : "and";
        if (TextBox2.Text.Length > 0)
            Sql = Sql + Ast2 + " (SType Like '%" + TextBox2.Text + "%') ";

        Master.SetWhere(Sql);
        wgvMaster.DataBind();
    }
}
